package cn.spider.visual;

import cn.spider.pojo.HotTopic;
import cn.spider.service.ReportServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

/**
 * Created by laoYang on 2018/4/22.
 */
@WebServlet(name = "HeatedTopServlet", urlPatterns = {"/heated.a"})
public class HeatedTop extends HttpServlet {


    private ReportServiceImpl reportService = new ReportServiceImpl();

    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {

        System.out.println("=================");

        List<HotTopic> list = reportService.getCurrentTop20();
        req.setAttribute("list", list);
        req.setAttribute("p", "hot");

        req.getRequestDispatcher("heated.jsp").forward(req, resp);
    }
}
